#ifndef SWEEPWIDGET_H
#define SWEEPWIDGET_H

#include <QGLWidget>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QTime>
#include <QFile>
#include <QTextStream>
#include <string>
#include <cstdio>
#include <typeinfo>
#include "sweeppolyhedra.h"
#include "camera.h"

using namespace std;

class SweepWidget : public QGLWidget
{
public:

    SweepPolyhedra poly;
    Trajectory trajectory;
    BaseCurve baseCurve;
    Camera cam;
    Camera defaultCam;
    Camera axisCam;
    QTime *timer;
    QPoint lastPos;
    bool showNormals;

    //Width and height of the window
    int w,h;

    SweepWidget(QWidget *parent);
    ~SweepWidget();

    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void keyPressEvent(QKeyEvent *event);
    void updateAxisCam();
    void resetCam();

    void initializeGL();
    void resizeGL( int w, int h );

    void initLightingModel();

    void paintGL();
    void drawCoordSystemReferences();
    void drawAxis(GLUquadric *quadric);

    SweepPolyhedra readPoly(QString fileName);
    BaseCurve readBaseCurve(QTextStream &in);
    Trajectory readTrajectory(QTextStream &in);
    void readCoords(QTextStream &in , double* coords);
    Trajectory processTrajectory(Trajectory trajectory);
};

#endif // SWEEPWIDGET_H
